% TODO proof-reading
\subsubsection{Three-dimensional arrays}

Three-dimensional arrays are just one-dimensional arrays of \IT{references} 
to one-dimensional arrays of \IT{references}.


\begin{lstlisting}[style=customjava]
	public static void main(String[] args)
	{
		int[][][] a = new int[5][10][15];

		a[1][2][3]=4;

		get_elem(a);
	}
\end{lstlisting}

\begin{lstlisting}
  public static void main(java.lang.String[]);
    flags: ACC_PUBLIC, ACC_STATIC
    Code:
      stack=3, locals=2, args_size=1
         0: iconst_5      
         1: bipush        10
         3: bipush        15
         5: multianewarray #2,  3     // class "[[[I"
         9: astore_1      
        10: aload_1       
        11: iconst_1      
        12: aaload        
        13: iconst_2      
        14: aaload        
        15: iconst_3      
        16: iconst_4      
        17: iastore       
        18: aload_1       
        19: invokestatic  #3          // Method get_elem:([[[I)I
        22: pop           
        23: return        
\end{lstlisting}

Now it takes two \TT{aaload} instructions to find right \IT{reference}:


\begin{lstlisting}[style=customjava]
	public static int get_elem (int[][][] a)
	{
		return a[1][2][3];
	}
\end{lstlisting}

\begin{lstlisting}
  public static int get_elem(int[][][]);
    flags: ACC_PUBLIC, ACC_STATIC
    Code:
      stack=2, locals=1, args_size=1
         0: aload_0       
         1: iconst_1      
         2: aaload        
         3: iconst_2      
         4: aaload        
         5: iconst_3      
         6: iaload        
         7: ireturn       
\end{lstlisting}
